package net.com.sunkey.messagehandler;

import net.com.sunkey.protobuf.Protocol;
import net.com.sunkey.protobuf.RoomMessageRequest.RoomMessageRequestData;
import net.com.sunkey.serverlogic.Message;
import net.com.sunkey.serverlogic.User;

/**
 * @author kohachiro
 *
 */
public class RoomMessageRequestHandler {
	/**
	 * 
	 */
	//@Override
	public static int invoke(Object data, Object channel) throws Exception {
		System.out.println("["+channel.hashCode()+"]["+ Protocol.MessageHandler.RoomMessageRequest_VALUE+"]RoomMessageRequest");		

		User sender=User.get(channel);
		Message mesage=new Message(((RoomMessageRequestData)data).getMessage(),sender,Protocol.MessageRouter.ROUTER_ROOM_VALUE);
		sender.sendToRoom(mesage);
		return Protocol.MessageHandler.RoomMessageRequest_VALUE;
	}
}
